//
//  BBWorkReportCell.m
//  BearSiX
//
//  Created by BearBaby on 16/3/29.
//  Copyright © 2016年 Tom. All rights reserved.
//

#import "BBWorkReportCell.h"

@implementation BBWorkReportCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.array = @[@"3.png",@"4.png"];
        //头像
        self.headImage = [[UIImageView alloc]initWithFrame:CGRectMake(15, 15, 50, 50)];
        self.headImage.layer.cornerRadius = 25;
        self.headImage.layer.masksToBounds = YES;
        self.headImage.image = [UIImage imageNamed:@"2.png"];
        [self addSubview:self.headImage];
        //姓名
        self.nameLabel = [[UILabel alloc]init];
        self.nameLabel.text = @"张蕊";
        self.nameLabel.textColor = [UIColor colorWithHexString:@"e1464d"];
        self.nameLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/25];
        CGSize nameSize = [self.nameLabel.text sizeWithFont:self.nameLabel.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByWordWrapping];
        self.nameLabel.frame = CGRectMake(CGRectGetMaxX(self.headImage.frame)+10, 20, nameSize.width, nameSize.height);
        [self addSubview:self.nameLabel];
        //时间
        self.timeLabel = [[UILabel alloc]init];
        self.timeLabel.text = @"2015-12-20 10:00";
        self.timeLabel.textColor = [UIColor colorWithHexString:@"a5a5a5"];
        self.timeLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/27];
        CGSize timeSize = [self.timeLabel.text sizeWithFont:self.timeLabel.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByWordWrapping];
        self.timeLabel.frame = CGRectMake(CGRectGetMaxX(self.headImage.frame)+10, CGRectGetMaxY(self.headImage.frame) - 5-timeSize.height, timeSize.width, timeSize.height);
        [self addSubview:self.timeLabel];
 
        
        //内容
        self.contentLabel = [[UILabel alloc]init];
        self.contentLabel.text = @"婚纱集团(套系新增停用日期、新增套系全部删除权限、电子工作薄摄影拍照新增类别)。";
        self.contentLabel.numberOfLines = 0;
        self.contentLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/22];
        CGSize contentSize = [self.contentLabel.text sizeWithFont:self.contentLabel.font constrainedToSize:CGSizeMake(WINSIZEWIDTH - 30, 300) lineBreakMode:NSLineBreakByWordWrapping];
        self.contentLabel.frame = CGRectMake(15, CGRectGetMaxY(self.headImage.frame)+10, contentSize.width, contentSize.height);
        [self addSubview:self.contentLabel];
        //图片
        for (int i = 0; i<self.array.count; i++) {
            self.imageV = [[UIImageView alloc]initWithFrame:CGRectMake(15+((WINSIZEWIDTH - 40)/3+5)*i, CGRectGetMaxY(self.contentLabel.frame)+10, (WINSIZEWIDTH - 40)/3, (WINSIZEWIDTH - 40)/3)];
            self.imageV.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",self.array[i]]];
            [self addSubview:self.imageV];
        }
//横线
        self.line = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.imageV.frame)+15, WINSIZEWIDTH, 1)];
        self.line.backgroundColor = [UIColor colorWithHexString:@"e0e1e2"];
        [self addSubview:self.line];
        
        //消息数量
        self.messageLabel = [[UILabel alloc]init];
        self.messageLabel.text = @"10";
        self.messageLabel.textColor = [UIColor colorWithHexString:@"a0a1a2" alpha:1];
        self.messageLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/27];
        CGSize messageSize = [self.messageLabel.text sizeWithFont:self.messageLabel.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByCharWrapping];
        
        self.messageBtn = [[UIButton alloc]initWithFrame:CGRectMake(WINSIZEWIDTH/6 - (messageSize.height*1.2 + 5 + messageSize.height)/2, CGRectGetMaxY(self.line.frame)+15, messageSize.height*1.2, messageSize.height)];
        [self.messageBtn setBackgroundImage:[UIImage imageNamed:@"20-1"] forState:UIControlStateNormal];
        [self addSubview:self.messageBtn];
        
        self.messageLabel.frame = CGRectMake(CGRectGetMaxX(self.messageBtn.frame)+5, CGRectGetMaxY(self.line.frame)+15, messageSize.width, messageSize.height);
        [self addSubview:self.messageLabel];
    
        
        //竖线
        self.vertical1 = [[UILabel alloc]initWithFrame:CGRectMake(WINSIZEWIDTH/3, CGRectGetMaxY(self.line.frame)+10, 1, messageSize.height+10)];
        self.vertical1.backgroundColor = [UIColor colorWithHexString:@"e0e1e2" alpha:1];
        [self addSubview:self.vertical1];
        
        
        //分享数量
        self.shareLabel = [[UILabel alloc]init];
        self.shareLabel.text = @"120";
        self.shareLabel.textColor = [UIColor colorWithHexString:@"a0a1a2" alpha:1];
        self.shareLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/27];
        CGSize shareSize = [self.shareLabel.text sizeWithFont:self.shareLabel.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByCharWrapping];
        
        self.shareBtn = [[UIButton alloc]initWithFrame:CGRectMake(WINSIZEWIDTH/2 - (shareSize.height*1.2 + 5 + shareSize.height)/2, CGRectGetMaxY(self.line.frame)+15, shareSize.height*1.2, shareSize.height)];
        [self.shareBtn setBackgroundImage:[UIImage imageNamed:@"20-2"] forState:UIControlStateNormal];
        [self addSubview:self.shareBtn];
        
        self.shareLabel.frame = CGRectMake(CGRectGetMaxX(self.shareBtn.frame)+5, CGRectGetMaxY(self.line.frame)+15, shareSize.width, shareSize.height);
        [self addSubview:self.shareLabel];
        //竖线
        self.vertical2 = [[UILabel alloc]initWithFrame:CGRectMake(WINSIZEWIDTH/3*2, CGRectGetMaxY(self.line.frame)+10, 1, messageSize.height+10)];
        self.vertical2.backgroundColor = [UIColor colorWithHexString:@"e0e1e2" alpha:1];
        [self addSubview:self.vertical2];
        
        
        //已看数量
        self.seeLabel = [[UILabel alloc]init];
        self.seeLabel.text = @"12";
        self.seeLabel.textColor = [UIColor colorWithHexString:@"a0a1a2" alpha:1];
        self.seeLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/27];
        CGSize seeSize = [self.seeLabel.text sizeWithFont:self.seeLabel.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByCharWrapping];
        
        self.seeBtn = [[UIButton alloc]initWithFrame:CGRectMake(WINSIZEWIDTH/6*5 - (seeSize.height*1.5 + 5 + seeSize.height)/2, CGRectGetMaxY(self.line.frame)+15, seeSize.height*1.5, seeSize.height)];
        [self.seeBtn setBackgroundImage:[UIImage imageNamed:@"20-3"] forState:UIControlStateNormal];
         self.seeBtn.contentMode = UIViewContentModeScaleAspectFit;
        [self addSubview:self.seeBtn];
        
        self.seeLabel.frame = CGRectMake(CGRectGetMaxX(self.seeBtn.frame)+5, CGRectGetMaxY(self.line.frame)+15, seeSize.width, seeSize.height);
        [self addSubview:self.seeLabel];
        
        _finalH = CGRectGetMaxY(self.vertical1.frame)+10;
        
    }
    
    
    return self;
}
@end
